import http from "@/api";

import { ResPage } from "@/api/interface";

import { JobEntity, JobVo, JobWorkerVo } from "@/biz/interface/JobType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取发布的岗位列表
export const getJobVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/cpyjob/ftvolist`, params);
};



// * 新增发布的岗位接口
export const saveJobApi = (job: JobEntity) => {
  return http.post(moduleUrl + `/cpyjob/ftsave`, job);
};

// * 详情发布的岗位接口
export const getJobInfoApi = (params: { id: string }) => {
  return http.post<JobEntity>(moduleUrl + `/cpyjob/info`, params);
};

// * 删除发布的岗位接口
export const deleteJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/delete`, params);
};

// * 修改发布的岗位状态接口
export const changeFlagActiveApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/ftactive`, params);
};

// * 获取还有多少个免费的次数
export const getAreafeeCntApi = (params: {}) => {
  return http.post(moduleUrl + `/cpyjob/jobfreecnt`, params);
};

// * 获取每个区域的发布的费用
export const getAreafeesApi = (params: {}) => {
  return http.post(moduleUrl + `/cpyjob/jobpubfee`, params);
};

// * 正在招聘中的岗位下架
export const setJobOffline = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyjob/offline`, params);
};

// * 获取岗位中的工人列表, 带分页
export const getApplyJobWorkersVoListApi = (params: {}) => {
  return http.post<ResPage<JobWorkerVo>>(moduleUrl + `/cpyjob/jobworkersvolist`, { ...params, flagApply: "Y" });
};
export const getViewJobWorkersVoListApi = (params: {}) => {
  return http.post<ResPage<JobWorkerVo>>(moduleUrl + `/cpyjob/jobworkersvolist`, { ...params, flagView: "Y" });
};

// * 查找岗位的刷新
export const getJobRefreshApi = (params: { jobId: string }) => {
  return http.post(moduleUrl + `/cpyjob/jobrefreshinfo`, params);
};

// * 新增岗位的刷新计划
export const saveJobRefreshApi = (params: {}) => {
  return http.post(moduleUrl + `/cpyjob/jobrefreshsave`, params);
};

// * 运行一次立即执行
export const runonceJobRefreshApi = (params: { jobId: string }) => {
  return http.post(moduleUrl + `/cpyjob/jobrefreshnow`, params);
};

// * 停止岗位的刷新计划
export const stopJobRefreshApi = (params: { jobId: string }) => {
  return http.post(moduleUrl + `/cpyjob/jobrefreshstop`, params);
};
